const Router = require('koa-router')
const { handleUser } = require('./user.middleware')
const { handlePassword } = require('../../middleware/password.middleware')
const { verifyToken } = require('../../middleware/verify.middleware')
const { create, updatePassword } = require('./user.controller')

const userRouter = new Router({ prefix: '/user' })

// 用户注册
userRouter.post('/', handleUser, handlePassword, create)

// 更新密码
userRouter.patch('/password', verifyToken, handlePassword, updatePassword)

module.exports = userRouter
